using System;
using System.Data;
using System.Collections.Generic;
using PPI.Entities;
using PPI.Entities.Lookup;
using VMind.Global;
using System.Text;

namespace PPI.Client.Logic
{
	public static class LXMissionStructures_TopType
	{
        public static List<EXMissionStructures_TopType> SelectAllIdName()
        {
            DataTable dt = WebConsumer.WXMissionStructures_TopType.SelectAllIdName().Tables[0];
            return ParseIdName(dt);
        }

        public static List<EXMissionStructures_TopType> SelectAllIdNameByType(Int32 type)
        {
            DataTable dt = WebConsumer.WXMissionStructures_TopType.SelectAllIdNameByType(type).Tables[0];
            return ParseIdName(dt);
        }

        private static List<EXMissionStructures_TopType> ParseIdName(DataTable dt)
	    {
            List<EXMissionStructures_TopType> _returnList = new List<EXMissionStructures_TopType>();
	        foreach (DataRow dr in dt.Rows)
	        {
	            EXMissionStructures_TopType p = new EXMissionStructures_TopType();
	            p.XMissionStructures_TopTypeId = ConvertHelper.ToInt32(dr["XMissionStructures_TopTypeId"]);
	            p.Name = dr["Name"].ToString();
	            _returnList.Add(p);
	        }
            return _returnList;
	    }
	}
}

